//
//  HealthTableView.m
//  SHHCPhone
//
//  Created by sheng long on 14-7-4.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "HealthTableView.h"
#import "HealthViewCell.h"
#import "HealthDetailsViewController.h"

@implementation HealthTableView

@synthesize supVC;

#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.autoDataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *CellIdentifier = [NSString stringWithFormat:@"cell%d",indexPath.section];
    HealthViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil){
        
        cell = [[HealthViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier size:[tableView rectForRowAtIndexPath:indexPath].size];
        [cell setBackgroundColor:[UIColor clearColor]];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    [cell setContent:[self.autoDataArray objectAtIndex:indexPath.row]];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 195;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    HealthDetailsViewController *view = [[HealthDetailsViewController alloc] init];
    view.listInfo = [self.autoDataArray objectAtIndex:indexPath.row];
    [self.supVC.navigationController pushViewController:view animated:YES];
}


@end
